using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.SessionState;
namespace SIS.BLL.Entities
{
   public static class CurrentLogin
    {
        private static bool IsNull(string key)
        {
            return (HttpContext.Current.Session[key] == null);
        }

        private static HttpSessionState Session
        {
            get { return HttpContext.Current.Session; }
        }

        public static string LastLoginDate
        {
            get
            {
                if (Session[GlobalConstant.LASTLOGIN_DATE] == null)
                    Session[GlobalConstant.LASTLOGIN_DATE] = "";
                return Convert.ToString(Session[GlobalConstant.LASTLOGIN_DATE]);
            }
            set
            {
                Session[GlobalConstant.LASTLOGIN_DATE] = value;
            }
        }
       public static string LoginId
       {
           get
           {
               return Convert.ToString(Session[GlobalConstant.LOGIN_ID]);
           }
           set
           {
               Session[GlobalConstant.LOGIN_ID] = value;
           }
       }
       public static string RoleName
       {
           get
           {
               return Convert.ToString(Session[GlobalConstant.ROLE_NAME]);
           }
           set
           {
               HttpContext.Current.Session[GlobalConstant.ROLE_NAME] = value;
           }
       }
       public static int RoleID
       {
           get
           {
               if (IsNull(GlobalConstant.LOGIN_ROLE))
               {
                   Session[GlobalConstant.LOGIN_ROLE] = default(int);
               }
               return (int)Session[GlobalConstant.LOGIN_ROLE];
           }
           set
           {
               HttpContext.Current.Session[GlobalConstant.LOGIN_ROLE] = value;
           }
       }
       public static string DisplayName
       {
           get
           {
               if (IsNull(GlobalConstant.DISPLAY_NAME))
               {
                   Session[GlobalConstant.DISPLAY_NAME] = default(string);
               }
               return (string)Session[GlobalConstant.DISPLAY_NAME];
           }
           set
           {
               HttpContext.Current.Session[GlobalConstant.DISPLAY_NAME] = value;
           }
       }
       public static bool IsLogin
       {
           get
           {
               if (IsNull(GlobalConstant.ISLOGIN))
               {
                   Session[GlobalConstant.ISLOGIN] = default(bool);
               }
               return (bool)Session[GlobalConstant.ISLOGIN];
           }
           set
           {
               HttpContext.Current.Session[GlobalConstant.ISLOGIN] = value;
           }
       }
    }
}
